<!DOCtype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>vue_011_遍历</title>
</head>
<body>
    <div id="app">
        <div v-for="(item,key,index) in obj">{{item + "---" + key + "---" + index}}</div>
        v-if和v-for结合来使用
        <div v-if="item==12" v-for="(item,key,index) in obj">{{item + "---" + key + "---" + index}}</div>
    </div>
    <script src="js/vue.js"></script>
    <script type="text/javascript">
        //原生的js遍历对象
        var obj = {
            id:1,
            name:"zhangsan",
            age:15
        }
        for(var key in obj){
            console.log(key + "---" + obj[key]);
        }
        //vue遍历
        var vm = new Vue({
            el:'#app',
            data:{
               obj:{
                id:2,
                name:"lisi",
                age:12
               }
            }
        });

    </script>
</body>

</html></SCRIPT>